import { http } from '@/common/service/service.js'

// 质量检查相关API
export const qualityApi = {
  // 获取质量检查列表
  getList(params) {
    return http.get('/mes/quality/list', params)
  },

  // 获取质量检查详情
  getDetail(id) {
    return http.get(`/mes/quality/detail/${id}`)
  },

  // 创建质量检查记录
  create(data) {
    return http.post('/mes/quality/create', data)
  },

  // 处理质量检查
  handle(id, data) {
    return http.post(`/mes/quality/handle/${id}`, data)
  },

  // 解决质量问题
  resolve(id, data) {
    return http.post(`/mes/quality/resolve/${id}`, data)
  }
}

// 异常管理相关API
export const exceptionApi = {
  // 获取异常列表
  getList(params) {
    return http.get('/mes/exception/list', params)
  },

  // 上报异常
  report(data) {
    return http.post('/mes/exception/report', data)
  },

  // 处理异常
  handle(id, data) {
    return http.post(`/mes/exception/handle/${id}`, data)
  },

  // 解决异常
  resolve(id, data) {
    return http.post(`/mes/exception/resolve/${id}`, data)
  }
}

// 设备管理相关API
export const equipmentApi = {
  // 获取设备列表
  getList(params) {
    return http.get('/mes/equipment/list', params)
  },

  // 更新设备状态
  updateStatus(id, data) {
    return http.post(`/mes/equipment/status/${id}`, data)
  },

  // 设备维护
  maintenance(id, data) {
    return http.post(`/mes/equipment/maintenance/${id}`, data)
  }
}
